package com.student_exam_system.Util;

import java.util.HashMap;
import java.util.Map;

/**
 * @author fire'ge
 */
public class SimpleCache {
    private final Map<String,Object> cacheMap = new HashMap<>();

    public Map<String, Object> getCacheMap() {
        return cacheMap;
    }

    private SimpleCache() {}

    private static class CacheHolder {
        private static final SimpleCache INSTANCE = new SimpleCache();

    }


    public static SimpleCache getInstance() {
        return CacheHolder.INSTANCE;
    }

    public void putObject(String key , Object object){
        cacheMap.put(key, object);
    }
    public Object getObject(String key){
        return cacheMap.get(key);
    }
    public void remove(String key){
        cacheMap.remove(key);
    }
}
